import apiClient from './';
export const endpoints = {
    GOODS_DETAIL: '/goods/detail/',
    CATEGORIES: '/categories',
    SEARCH:"/search"
}
export const queryGoodsDetail=(id)=>{
    return apiClient.get(`${endpoints.GOODS_DETAIL}${id}`);
}
export const queryCategories=()=>{
    return apiClient.get(endpoints.CATEGORIES);
}
/**
 * 搜索商品列表
 * @param {*} pageNumber 查询的页码
 * @param {*} keyword 搜索的关键字
 * @param {*} orderBy 排序的规则 推荐''  新品new 价格price
 * @param {*} goodsCategoryId 分类的ID
 */
export const searchGoods = (pageNumber,keyword,orderBy,goodsCategoryId)=>{
    let params = {pageNumber,orderBy,keyword};
    if(goodsCategoryId){
        params.goodsCategoryId = goodsCategoryId;
    }
    return apiClient.get(endpoints.SEARCH,params);
}